// 静态（常量）路由：任何用户登录进来都可以访问
export const constantRoutes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login.vue'),
    meta: {
      title: '登录',
      hidden: true,
    },
  },
  {
    path: '/',
    redirect: '/home',
    name: 'Layout',
    meta: {
      title: 'Layout',
    },
    component: () => import('@/layout/index.vue'),
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import('@/views/home.vue'),
        meta: {
          title: '首页',
        },
      },
    ],
  },
  // {
  //   //任意路由
  //   path: '/:pathMatch(.*)*',
  //   name: '404',
  //   component: () => import('@/views/404.vue'),
  //   meta: {
  //     title: 'not found',
  //     hidden: true,
  //   },
  // },
]

// 动态路由：只有用户有相应的权限才可以访问
export const asyncRoutes = [
  {
    path: '/goods',
    component: () => import('@/layout/index.vue'),
    name: 'goodsmanage',
    meta: {
      title: '商品管理',
    },
    children: [
      {
        path: '/goods/list',
        name: 'goodslist',
        component: () => import('@/views/goodslist.vue'),
        meta: {
          title: '商品列表',
        },
      },
      {
        path: '/goods/add',
        name: 'goodsadd',
        component: () => import('@/views/goodsadd.vue'),
        meta: {
          title: '商品添加',
        },
      },
    ],
  },
  {
    path: '/order',
    name: 'ordermanage',
    meta: {
      title: '订单管理',
    },
    component: () => import('@/layout/index.vue'),
    children: [
      {
        path: '/order/list',
        name: 'orderlist',
        component: () => import('@/views/orderlist.vue'),
        meta: {
          title: '订单列表',
        },
      },
    ],
  },
]

export const anyRoute = {
  // 任意路由
  path: '/404',
  name: '404',
  component: () => import('@/views/404.vue'),
  meta: {
    title: 'not found',
    hidden: true,
  },
}
